package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

import java.util.Date;

/**
 * 大攻略
 */
@Getter
@Setter
public class StrategyComment extends BaseDomain {
    public final static int STATE_COMMON = 0;//普通
    public final static int STATE_HOT = 1;//热门
    public final static int STATE_DISABLE = -1;//禁用
    //用户
    private User user;
    //创建时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;
    //内容
    private String content;
    //图片地址
    private String imgUrls;
    //星星数量
    private Integer starNum;
    //大攻略
    private Strategy strategy;
    //状态
    private Integer state = STATE_COMMON;
    //推荐时间
    private Date commendTime;
    //评论数
    private int commentNum;

    public String[] getImgUrlsArr(){
        if (StringUtils.hasLength(imgUrls)){
            return imgUrls.split(";");
        }
        return null;
    }

}